home *** CD-ROM | disk | FTP | other *** search
/ Chip 2002 February / CHIPCD_02_2002.iso / Internet / Macromedia ColdFusion Server 5 / coldfusion-50-win-us.exe / data1.cab / Examples / CFDOCS / snippets / cfldap.cfm < prev    next >
Encoding:
Text File  |  2001-06-13  |  2.1 KB  |  82 lines

  1. <!---  This example shows the use of CFLDAP --->
  2. <HTML>
  3. <HEAD>
  4. <TITLE>CFLDAP Example</TITLE>
  5. </HEAD>
  6.  
  7. <BASEFONT FACE="Arial, Helvetica" SIZE=2>
  8. <BODY  bgcolor="#FFFFD5">
  9.  
  10. <H3>CFLDAP Example</H3>
  11.  
  12. <P>CFLDAP provides an interface to LDAP 
  13. (Lightweight Directory Access Protocol) directory
  14. servers like BigFoot (<a href="http://www.bigfoot.com">http://www.bigfoot.com</A> and Four11 (<a href="http://www.four11.com">http://www.four11.com</A>).
  15.  
  16. <P>Enter a name (try your own name) and search a public
  17. LDAP resource.
  18.  
  19. <FORM ACTION="cfldap.cfm" METHOD="POST">
  20. <TABLE BORDER=0 CELLSPACING=2 CELLPADDING=2>
  21. <TR>
  22.  <TH ALIGN="RIGHT">Name:</TH>
  23.  <TD><INPUT TYPE="text" NAME="name"></TD>
  24. </TR>
  25. <TR>
  26.  <TH ALIGN="RIGHT">Server:</TH>
  27.  <TD>
  28.   <SELECT NAME="server">
  29.        <OPTION VALUE="Four11">Four11
  30.   </SELECT>
  31.  </TD>
  32. </TR>
  33. <TR>
  34.  <TH COLSPAN=2><INPUT TYPE="submit" VALUE="Search"></TH>
  35. </TR>
  36. </TABLE>
  37. </FORM>
  38.  
  39. <!--- If the server has been defined, run the query --->
  40. <CFIF IsDefined("form.server")>
  41. <!--- check to see that there is a name listed --->
  42. <CFIF form.name is not "">
  43. <!--- make the LDAP query --->
  44. <CFLDAP
  45.  SERVER="ldap.four11.com"
  46.  ACTION="QUERY"
  47.  NAME="results"
  48.  START="cn=#name#,c=US"
  49.  FILTER="(cn=#name#)"
  50.  ATTRIBUTES="cn,o,l,st,c,mail,telephonenumber"
  51.  SORT="cn ASC">
  52.  
  53. <!--- Display results --->
  54.     <CENTER>
  55.     <TABLE BORDER=0 CELLSPACING=2 CELLPADDING=2>
  56.      <TR>
  57.           <TH COLSPAN=5><CFOUTPUT>#results.RecordCount# matches found</CFOUTPUT></TH>
  58.      </TR>
  59.      <TR>
  60.           <TH><FONT SIZE="-2">Name</FONT></TH>
  61.           <TH><FONT SIZE="-2">Organization</FONT></TH>
  62.           <TH><FONT SIZE="-2">Location</FONT></TH>
  63.           <TH><FONT SIZE="-2">E-Mail</FONT></TH>
  64.           <TH><FONT SIZE="-2">Phone</FONT></TH>
  65.      </TR>
  66.     <CFOUTPUT QUERY="results">
  67.      <TR>
  68.           <TD><FONT SIZE="-2">#cn#</FONT></TD>
  69.           <TD><FONT SIZE="-2">#o#</FONT></TD>
  70.           <TD><FONT SIZE="-2">#l#, #st#, #c#</FONT></TD>
  71.           <TD><FONT SIZE="-2"><A HREF="mailto:#mail#">#mail#</A></FONT></TD>
  72.           <TD><FONT SIZE="-2">#telephonenumber#</FONT></TD>
  73.      </TR>
  74.     </CFOUTPUT>
  75.     </TABLE>
  76.     </CENTER>
  77. </CFIF>
  78. </CFIF>
  79.  
  80. </BODY>
  81. </HTML>       
  82.